package leetcode2;

public class Day9 {

    class ListNode {
        int val;
        Day7.ListNode next = null;
        public ListNode(int val) {
            this.val = val;
        }
    }




    //找出链表环的入口节点
   /* private ListNode EntryNodeOfLoop(ListNode pHead) {
        if(pHead == null ) return null;
        //if(pHead.next == pHead) return pHead;
        ListNode slow = pHead;
        ListNode fast = pHead;
        while(fast != null && fast.next != null) {
            fast = fast.next.next;
            slow = slow.next;
            if(fast == slow) {
                //只能判断有环
                slow=pHead;//重新走
                while(slow != fast) {
                    slow = slow.next;
                    fast = fast.next;
                }
                return slow;
            }
        }
        return null;
    }*/


    //合并两个有序链表
   /* public ListNode Merge (ListNode pHead1, ListNode pHead2) {
        // write code here
        ListNode newHead = new ListNode(-1);
        ListNode cur = newHead;
        ListNode cur1 = pHead1;
        ListNode cur2 = pHead2;
        while(cur1 != null && cur2 != null) {
            if(cur1.val > cur2.val) {
                cur.next = cur2;
                cur = cur.next;
                cur2 = cur2.next;
            }else {
                cur.next = cur1;
                cur = cur.next;
                cur1 = cur1.next;
            }
        }
        if(cur1 != null) {
            cur.next = cur1;
        }else {
            cur.next = cur2;
        }

        return newHead.next;
    }*/

}
